home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / progjour / 1991 / 01 / dos_errs.asm < prev    next >
Assembly Source File  |  1990-04-29  |  1KB  |  57 lines

  1.     title    ms_dos_strerror - ms_dos interface that sets error string
  2.     include    asm.inc
  3.  
  4.     .data
  5. error_strings    dw    err1,err2,err3,err4,err5,err6,err7,err8,err9,err10
  6.         dw    err11,err12,err13,err14,err15,err16,err17,err18
  7.  
  8. err1        db    'Invalid function',0
  9. err2        db    'File not found',0
  10. err3        db    'Path not found',0
  11. err4        db    'No handles left',0
  12. err5        db    'Access denied',0
  13. err6        db    'Invalid handle',0
  14. err7        db    'Memory ctrl blks destroyed',0
  15. err8        db    'Insufficient memory',0
  16. err9        db    'Invalid memory blk adr',0
  17. err10        db    'Invalid environment',0
  18. err11        db    'Invalid format',0
  19. err12        db    'Invalid access code',0
  20. err13        db    'Invalid data',0
  21. err14        db    '?',0
  22. err15        db    'Invalid drive',0
  23. err16        db    'Deleting current dir',0
  24. err17        db    'Not same device',0
  25. err18        db    'No more files',0
  26. MAX_ERROR_CODE    equ    18
  27.  
  28.     .code
  29.     extn    ms_dos,set_strerror
  30.     public    ms_dos_strerror
  31.  
  32.  
  33. ;;    ms dos strerror
  34. ;
  35. ms_dos_strerror proc
  36.     call    ms_dos
  37.     jc    mde1            ;  if error during dos function
  38.     ret
  39.  
  40. mde1:    push    ax
  41.     cmp    ax,MAX_ERROR_CODE
  42.     ja    mde2            ;  if error code too high
  43.     add    ax,ax
  44.     jz    mde2            ;  if error code too low
  45.  
  46.     xchg    ax,si            ; set error string
  47.     mov    si,error_strings[bp+si-2]
  48.     xchg    ax,si
  49.     call    set_strerror
  50.  
  51. mde2:    stc
  52.     pop    ax
  53.     ret
  54. ms_dos_strerror endp
  55.  
  56.     end
  57.